package io.github.neo.hhcache.command.string;

import io.github.neo.hhcache.core.Command;
import io.github.neo.hhcache.core.HHCache;
import io.github.neo.hhcache.entry.Reply;

/**
 * @author: hhz
 * @create: 2024/7/10
 **/
public class SetCommand implements Command {
    @Override
    public String name() {
        return "SET";
    }

    @Override
    public Reply<?> exec(HHCache cache, String[] args) {
        String key = getKey(args);
        String value = getVal(args);
        cache.set(key, value);
        return Reply.string(OK);
    }
}
